package test.factory;

import test.enums.VehicleProtocolEnum;
import test.processor.RequestProcessor;
import test.processor.impl.*;

/**
 * @author zhenjie.Ji
 * @description 工厂模式：车端报文数据处理工厂
 * @date 2025/1/16 14:03
 */
public class VehicleRequestProcessorFactory {
    /**
     * 根据请求的编码返回对应的处理器
     *
     * @param requestCode 请求编码
     * @return 返回对应的策略器
     */
    public static RequestProcessor getProcessor(VehicleProtocolEnum requestCode) {
        switch (requestCode) {
            case VEHICLE_KEY_UPLOAD:
                return new VehicleKeyUploadProcessor();
            case VEHICLE_KEY_DOWNLOAD:
                return new VehicleKeyDownloadProcessor();
            case VEHICLE_GET_DK_BLACK:
                return new VehicleGetDkBlackProcessor();
            case VEHICLE_MSG_RESULT:
                return new VehicleMsgResultProcessor();
            case VEHICLE_KEY_UPDATE:
                return new VehicleKeyUpdateProcessor();
            default:
                System.out.println("未知接口");
                return null;
        }
    }
}
